const mongoose = require('mongoose');

const personnelSchema = new mongoose.Schema({
  userId: { type: mongoose.Schema.Types.ObjectId, ref: 'User', required: true },
  currentLocation: {
    building: String,
    floor: String,
    room: String,
    coordinates: { x: Number, y: Number, z: Number },
    timestamp: { type: Date, default: Date.now }
  },
  status: { type: String, enum: ['in', 'out', 'break'], default: 'out' },
  checkInTime: Date,
  checkOutTime: Date
}, { timestamps: true });

module.exports = mongoose.model('Personnel', personnelSchema);